const express = require("express")
const mysql = require("mysql")





const app = express()

app.get("/", function (req, res) {
  let connection = mysql.createConnection({
    host: "mysql",
    user: "root",
    password: "root",
    database: 'dataflux'
  })
  
  connection.connect()
  connection.query("select 1+1 as sum", function (err, results, fields) {
    console.log(err, results)
    res.send("result: " + results[0].sum)
  })
  connection.end()
})

app.listen(3000, () => {
  console.log("the sever is running at port 3000")
})